<template>
	<view>
		<view class="fff_box" v-for="(item,index) in list" :key="index" @click="goDetail(item)">
			<view style="display: flex;align-items: center;justify-content: space-between;">
				<view style="color: #333333;font-size: 26rpx;">
					{{item.type==0?'企业咨询':'商学院'}}
				</view>
				<view style="color: #AAAAAA;font-size: 24rpx;">
					{{item.time}}
				</view>
			</view>
			<view class="aaaaa">
				{{item.title}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				FormData: {
					type: 0,
					page: 1,
					list_rows: 20,
				},
				list: [],
				last_page: 0,
			}
		},
		onLoad(options) {
			if (options.type) {
				this.FormData.type = options.type;
				let title = '企业咨询';
				if (options.type == 0) {
					title = '企业咨询';
				}
				if (options.type == 1) {
					title = '商学院';
				}
				uni.setNavigationBarTitle({
					title: title
				});
			}
			this.getData()
		},
		onPullDownRefresh() {
			this.FormData.page = 1;
			this.list = [];
			this.getData()
		},
		onReachBottom() {
			if (this.last_page > this.FormData.page) {
				this.FormData.page++;
				this.getData()
			}
		},
		methods: {
			goDetail(item){
				uni.navigateTo({
					url:`/pages/news/detail/detail?id=${item.id}`
				})
			},
			getData() {
				let self = this;
				let param = self.FormData
				uni.showLoading({
					title: '加载中...'
				});
				self._get('news.pages/lists', param, res => {
					self.list = self.list.concat(res.data.data);
					self.last_page = res.data.last_page;
					uni.hideLoading();
					uni.stopPullDownRefresh();
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.fff_box {
		width: 686rpx;
		margin: 20rpx auto;
		background-color: #fff;
		border-radius: 12rpx;
		padding: 20rpx;
		box-sizing: border-box;
	}

	.aaaaa {
		color: #AAAAAA;
		font-size: 24rpx;
		margin-top: 10rpx;
	}
</style>